package com.qf.flash.ui.home.adapter;

import android.widget.ImageView;

import com.qf.flash.R;
import com.qf.flash.constant.FlashCodes;
import com.qf.flash.model.ScriptRoleBean;
import com.qf.flash.utils.ImageLoader;
import com.qf.flashlib.adapter.BaseRViewItem;
import com.qf.flashlib.adapter.RViewHolder;

/**
 * 剧本角色
 * 2020/2/27 17:42
 */
public class RoleItem extends BaseRViewItem<ScriptRoleBean> {

    @Override
    public int getItemLayout() {
        return R.layout.item_role;
    }

    @Override
    public void convert(RViewHolder holder, ScriptRoleBean entity, int position, int itemSize) {
        ImageView ivRoleImg = holder.getView(R.id.iv_role_img);
        ImageLoader.load(ivRoleImg.getContext(), entity.getImage(), ivRoleImg);
        holder.setText(R.id.tv_role_name, entity.getName())
                .setText(R.id.tv_sex_age, FlashCodes.SEX_MAN.equals(entity.getSex()) ?
                        "男"  + "   " +entity.getAge():
                        "女" + "   " +entity.getAge())
                .setText(R.id.tv_role_introduce, entity.getContent());
    }
}
